<?php
/**
 * theme : default
 * template : home
 * description : template de la page d'accueil
 * author : Gmax
*/
$type = $this->getTargetType();
$posts = $this->getPublications();
?>
<div id="content" class="bg_site">
    <div class="container">
        <div class="columns sixteen">
        <?php if($type!=='page' && $this->getCategory()!==null): ?>
            <h1><?php echo $this->getCategory()->getTitle(); ?></h1>
            <?php if(count($posts)===1): ?>
            <article><div class="article" itemscope itemtype="http://schema.org/Article">
                <div class="post-content">
                    <h2 class="title" itemprop="name"><?php echo $posts[0]->getTitle(); ?></h2>
                    <?php echo $posts[0]->getContent(); ?>
                    
                </div>
            </div></article>
            <?php elseif(count($posts)>1): ?>
                <?php foreach($posts as $num=>$article): ?>
            <article><div class="article" itemscope itemtype="http://schema.org/Article">
                <div class="post-content">
                    <h2 class="title" itemprop="name">
                        <a href="<?php echo $article->getUrl(); ?>" title="<?php echo $article->getTitle(); ?>"><?php echo $article->getTitle(); ?></a>
                    </h2>
                    <?php echo $article->getContent(); ?>
                </div>
            </div></article>    
                <?php endforeach; ?>
            <?php else: ?>
            <article><div class="article">
                <div class="post-content">
                    <p>Page en construction</p>
                </div>
            </div></article>
            <?php endif; ?>
        <?php elseif($this->getTarget()!==null): ?>
            <article><div class="article" itemscope itemtype="http://schema.org/Article">
                <div class="post-content">
                    <h1 class="title" itemprop="name"><?php echo $this->translate($this->getTarget(), 'title'); ?></h1>
                    <?php echo $this->translate($this->getTarget(), 'content'); ?>
                </div>
            </div></article>
        <?php else: ?>
            <article><div class="article">
                <div class="post-content">
                    <p>Page en construction</p>
                </div>
            </div></article>
            <?php endif; ?>
        </div>
    </div>
</div>